//
//  DB_UnComfirmIAPOrderForm.h
//  KCiPhoneUnBreakPrison
//
//  Created by tanyu on 2/16/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>

@interface DB_UnComfirmIAPOrderForm : NSObject
{
    sqlite3 *_database;      // db
    BOOL    _bOpen;          // 数据库是否已经打开
    dispatch_queue_t backgroundQueue;
}
+ (DB_UnComfirmIAPOrderForm *)shareInstance;

// 返回数据库表中的唯一标识
- (NSInteger)insertReceip:(NSData *)receipArg
                  brandID:(NSString *)brandIDArg // 3GID，KC ID等
                productID:(NSString *)productIDArg
                 quantity:(NSInteger)quantityArg
              trasactonID:(NSString *)transactonIDArg;


- (BOOL)deleteReceipWithID:(NSInteger)receipIDArg;

// 如果数据库中有则将返回值通过参数返回，返回值为YES.反之返回NO
// 如果参数为nil或NULL则相当于测试数据库中是否还有未发送至服务器的receip
//- (BOOL)getReceipt:(NSData **)receipDataArg
//          recordID:(NSInteger *)recordIDArg
//           brandID:(NSString **)brandIDArg // 3GID，KC ID等
//         productID:(NSString **)productIDArg
//          quantity:(NSInteger *)quantityArg
//       trasactonID:(NSString **)transactonIDArg;
- (BOOL)getRecord:(NSMutableDictionary *)dict;

- (BOOL)updateRecharge_resultWithRecordID:(NSInteger)recordIDArg
                                    Value:(NSInteger)valueArg;

/**
 *  更新值订单号值
 *
 *  @param orderNo  订单id
 *  @param recordID 记录id
 *
 *  @return
 */
- (BOOL)updateRecharge_resultWithOrderNo:(NSString*)orderNo
                                    recordID:(NSInteger)recordID;
/**
 *  更新值订单号值与未上传服务器状态
 *
 *  @param orderNo  订单id
 *  @param valueArg 上传状态
 *  @param recordID 记录id
 *
 *  @return
 */
- (BOOL)updateRecharge_resultWithOrderNo:(NSString*)orderNo value:(NSInteger)valueArg recordID:(NSInteger)recordID;
@end
